import requests

# 参数太长，可以重新封装参数
# url = 'https://movie.douban.com/j/chart/top_list?type=24&interval_id=100%3A90&action=&start=0&limit=20'
url = 'https://movie.douban.com/j/chart/top_list'
param = {
    'type': '24',
    'interval_id': '100:90',
    'action': '',
    'start': '0',
    'limit': '20',
}
headers = {
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36'
}
res = requests.get(url=url, params=param, headers=headers)
print(res.request.headers)
print(res.request.url)
print(res.status_code)
print(res.json())
# 养成关闭请求的习惯，防止实际项目中长连接过多导致拥堵
# 包括打开文件之后也要记得关掉
res.close()
